package multiProocess;


class MyIThread implements Runnable {
    @Override
    public void run() {  // 覆写run()方法
        System.out.println("1、进入run()方法");
        try {
            Thread.sleep(10000);
            System.out.println("2、已经完成了休眠");
        } catch (InterruptedException e) {
            System.out.println("3、休眠被终止");
            return; // 返回调用处
        }
        System.out.println("4、run()方法正常结束");
    }
}

public class MyInterruptThread {
    public static void main(String[] args) {
        MyIThread mt = new MyIThread();
        Thread t = new Thread(mt, "线程");
        t.start();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            System.out.println("3、休眠被终止");
        }
        t.interrupt();
    }
}